package com.ebelter.seneo.ui.fragments.addinfos;


import android.os.Message;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.ebelter.btcomlib.common.IOrder;
import com.ebelter.btcomlib.utils.NumUtils;
import com.ebelter.btcomlib.utils.ViewUtils;
import com.ebelter.seneo.R;
import com.ebelter.seneo.ui.activitys.SeneoAddInfoActivity;
import com.ebelter.seneo.ui.fragments.BaseFragment;
import com.ebelter.seneo.ui.views.NumSelectorView;


//填写密码
public class AddInfo_Height_Fragment extends BaseFragment  implements IOrder {



    TextView addinfo_heightvalue_tv;
    NumSelectorView addinfo_numselector;

    TextView addinfo_height_tv;
    LinearLayout addinfo_height_ll;


    @Override
    protected void handleMsg(Message msg) {
        super.handleMsg(msg);
    }

    @Override
    protected int setLayoutResouceId() {
        return R.layout.addinfo_height_fly;
    }

    @Override
    protected void initView() {
        FV();
    }

    private void FV() {
        addinfo_numselector=findViewById(R.id.addinfo_numselector);
        addinfo_heightvalue_tv=findViewById(R.id.addinfo_heightvalue_tv);
        addinfo_height_tv=findViewById(R.id.addinfo_height_tv);
        addinfo_height_ll=findViewById(R.id.addinfo_height_ll);
        addinfo_numselector.setMinMaxNum(100,220);
        addinfo_numselector.setValue(168);
        ViewUtils.setTextViewStr(addinfo_heightvalue_tv, NumUtils.numBaoLiuWei0(168)+"");

        adapterUi();
    }

    private void adapterUi() {
        if (getActivity()==null)return;
       if (((SeneoAddInfoActivity)getActivity()).currentCMD==SeneoAddInfoActivity.CMD_register){
           //注册界面 不需要改任何界面

       }else {
           //添加用户信息界面
           ViewUtils.goneView(addinfo_height_tv);
           ViewUtils.setBottomMargin(addinfo_height_ll,90);
       }
    }


    @Override
    protected void setListener() {
        addinfo_numselector.setmValueChangeListener(new NumSelectorView.ValueChangeListener() {
            @Override
            public void changeValue(float value) {
                ViewUtils.setTextViewStr(addinfo_heightvalue_tv, NumUtils.numBaoLiuWei0(value)+"");
            }
        });
    }

    @Override
    public void cmd(int cmd, Object... objects) {

    }


    public float getHeight(){
        return addinfo_numselector.getValue();
    }
}
